#include <stdio.h>
#include <io.h>
#include <vector>
#include <cstring>

using namespace std;

int visit_file(char* dir, char* match_file, vector<string>* find_files)
{
    char newDir[256];
    struct _finddata_t files;
    intptr_t file_handle;

    strcpy(newDir, dir);
    strcat(newDir, match_file);

    file_handle = _findfirst(newDir, &files);
    if (file_handle == -1)
    {
        printf("error\n");
        return -1;
    }

    do 
    {
        if (_A_SUBDIR == files.attrib)
        {
            strcpy(newDir, dir);
            strcat(newDir, files.name);
            find_files->push_back(newDir);
        }
    } while (0 == _findnext(file_handle, &files));

    _findclose(file_handle);

    return 0;
}